#ifndef FACE_RECOGNIZER_H
#define FACE_RECOGNIZER_H
#include<vector>
#include<string>
#include"FaceClassifier.hpp"
#include"sphereface.h"
#include"FaceAlignment.h"
#include <memory>

namespace fr
{
	class FaceRecognizer
	{
	public:
		FaceRecognizer(float score_thresh=0.4f)
		{
			sphere_face = std::make_unique<SphereFace>(1, 3, FaceHeight, FaceWidth, true);
			face_classifier = std::make_unique<FaceClassifier>(1024,score_thresh);
		}

		bool load_model(const std::string& init_nets,
			const std::string& predict_nets);

		bool load_mean(const std::string& mean_file);

		void add_person(const std::string& name, const std::vector<float>& feature);

		void add_person(const std::string& name, cv::Mat face_image, const std::vector<cv::Point2f> &face_landmarks=std::vector<cv::Point2f>());

		std::pair<std::string, float> identify(const std::vector<float>& feature)const;

		std::pair<std::string, float> identify(cv::Mat face_image, const std::vector<cv::Point2f> &face_landmarks = std::vector<cv::Point2f>())const;

		std::vector<float> extract_feature(cv::Mat face_image, const std::vector<cv::Point2f> &face_landmarks = std::vector<cv::Point2f>()) const;

		virtual ~FaceRecognizer(){}

	private:
		std::unique_ptr<SphereFace> sphere_face;
		std::unique_ptr<FaceClassifier> face_classifier;
		const int FaceHeight = 112;
		const int FaceWidth = 96;
	};
}

#endif // !FACE_RECOGNIZER_H

